package sbp.teste;

import java.util.Calendar;
import sbp.dao.DAOFactory;
import sbp.dao.InformacaoDAO;
import sbp.modelos.Informacao;
import sbp.modelos.Pratica;
import sbp.util.HibernateUtil;

public class InformacaoDAOTest {
	
	public Informacao preencheInformacao() {
		Informacao informacao = new Informacao(Calendar.getInstance().getTime(), true, Calendar.getInstance().getTime(), "Melhor do que o esperado");
		return informacao;
	}
	
	public void salvaInformacao() {
		InformacaoDAO iDAO = DAOFactory.criarInformacaoDAO();
		HibernateUtil.getSessionFactory().getCurrentSession().beginTransaction();
		iDAO.salvar(preencheInformacao());
		HibernateUtil.getSessionFactory().getCurrentSession().getTransaction().commit();
		HibernateUtil.getSessionFactory().getCurrentSession().close();
	}
	
	public static void main(String[] args) {
		InformacaoDAOTest test = new InformacaoDAOTest();
		test.salvaInformacao();
	}
}
